package com.ssy.lingxi.member.merchant.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.dataauth.annotation.member.MemberAuth;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.MemberModifyPageVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.MemberModifyVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.ValidateIdVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.ValidateIdsVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.response.MemberModifyDetailVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.response.MemberModifyPageQueryVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.response.MemberModifySearchConditionVO;
import com.ssy.lingxi.member.merchant.service.web.IMemberAbilityModifyService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @menu 会员能力 - 会员变更审核相关接口
 * @author 万宁
 * @version 2.0.0
 * @date 2021-05-27
 */
@RestController
@RequestMapping("/member/modify")
public class MemberAbilityModifyController {
    @Resource
    private IMemberAbilityModifyService memberAbilityModifyService;

    /**
     * 获取会员变更各个步骤分页查询列表页面下拉框
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/page/conditions", method = RequestMethod.GET)
    public Wrapper<MemberModifySearchConditionVO> getModifyPageConditions(@RequestHeader HttpHeaders headers) {
        return memberAbilityModifyService.getModifyPageConditions(headers);
    }


    /**
     * 分页查询“待审核变更（一级）”会员列表
     * @param headers Http头部新
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/grade/one/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberModifyPageQueryVO>> pageToModifyGradeOne(@RequestHeader HttpHeaders headers, @Valid MemberModifyPageVO pageVO) {
        return memberAbilityModifyService.pageToModifyGradeOne(headers, pageVO);
    }

    /**
     * “待审核变更（一级）” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/one/detail", method = RequestMethod.GET)
    public Wrapper<MemberModifyDetailVO> getToModifyGradeOne(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityModifyService.getToModifyGradeOne(headers, idVO);
    }

    /**
     * “待审核变更（一级）” - 审核会员
     * @param headers Http头部信息
     * @param modifyVO 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/grade/one", method = RequestMethod.POST)
    public Wrapper<Void> toModifyGradeOne(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberModifyVO modifyVO) {
        return memberAbilityModifyService.toModifyGradeOne(headers, modifyVO);
    }

    /**
     * “待审核变更（一级）” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/one/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchToModifyGradeOne(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityModifyService.batchToModifyGradeOne(headers, idVO);
    }

    /**
     * 分页查询“待审核变更（二级）”会员列表
     * @param headers Http头部新
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/grade/two/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberModifyPageQueryVO>> pageToModifyGradeTwo(@RequestHeader HttpHeaders headers, @Valid MemberModifyPageVO pageVO) {
        return memberAbilityModifyService.pageToModifyGradeTwo(headers, pageVO);
    }

    /**
     * “待审核变更（二级）” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/two/detail", method = RequestMethod.GET)
    public Wrapper<MemberModifyDetailVO> getToModifyGradeTwo(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityModifyService.getToModifyGradeTwo(headers, idVO);
    }

    /**
     * “待审核变更（二级）” - 审核会员
     * @param headers Http头部信息
     * @param modifyVO 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/grade/two", method = RequestMethod.POST)
    public Wrapper<Void> toModifyGradeTwo(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberModifyVO modifyVO) {
        return memberAbilityModifyService.toModifyGradeTwo(headers, modifyVO);
    }

    /**
     * “待审核变更（二级）” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/two/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchToModifyGradeTwo(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityModifyService.batchToModifyGradeTwo(headers, idVO);
    }

    /**
     * 分页查询“待确认会员变更”会员列表
     * @param headers Http头部新
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/confirm/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberModifyPageQueryVO>> pageToConfirmModify(@RequestHeader HttpHeaders headers, @Valid MemberModifyPageVO pageVO) {
        return memberAbilityModifyService.pageToConfirmModify(headers, pageVO);
    }

    /**
     * “待确认会员变更” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/confirm/detail", method = RequestMethod.GET)
    public Wrapper<MemberModifyDetailVO> getToConfirmModify(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityModifyService.getToConfirmModify(headers, idVO);
    }

    /**
     * “待确认会员变更” - 审核会员
     * @param headers Http头部信息
     * @param modifyVO 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/confirm", method = RequestMethod.POST)
    public Wrapper<Void> toConfirmModify(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberModifyVO modifyVO) {
        return memberAbilityModifyService.toConfirmModify(headers, modifyVO);
    }

    /**
     * “待确认会员变更” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/confirm/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchToConfirmModify(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityModifyService.batchToConfirmModify(headers, idVO);
    }
}
